package com.zh.elec.dao.base;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class BaseDao extends HibernateDaoSupport {
	
	public Object saveOrUpdate(Object obj){
		this.getHibernateTemplate().saveOrUpdate(obj);
		return obj;
	}

	public void delete(Object obj){
		this.getHibernateTemplate().delete(obj);
	}
	
	@SuppressWarnings("rawtypes")
	public void deleteAll(Collection entities){
		this.getHibernateTemplate().deleteAll(entities);
	}
	
	public <T> Object get(Class<T> clss, Serializable id){
		return (Object)this.getHibernateTemplate().get(clss, id);
	}
	
	@SuppressWarnings("rawtypes")
	public List find(String queryString){
		return this.getHibernateTemplate().find(queryString);
	}
}
